package com.lipy.microorder.service.feign;

import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.util.JSONPObject;
import com.lipy.microorder.bean.Student;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: lipy
 * @create: 2020-06-20 09:16
 **/
@Service
public class StudentServiceImpl implements StudentService {
    @Override
    public String getAllStudent() {
        List<Student> list = new ArrayList<>();
        Student student = new Student();
        student.setId(1);
        student.setName("lisan");
        student.setCard_num("sanhaoxuesheng");
        list.add(student);
        return JSONObject.toJSONString(list);
    }

    @Override
    public String saveStudent(Student student) {
        System.out.println("JSONObject.toJSONString(student) = " + JSONObject.toJSONString(student));
        return "1";
    }

    @Override
    public String queryStudentById(Integer id) {
        Student student = new Student();
        student.setId(1);
        student.setName("lisan");
        student.setCard_num("sanhaoxuesheng");
        return JSONObject.toJSONString(student);
    }

    @Override
    public String errorMessage(Integer id) {
        int i = id / 0;

        return i + "";
    }

}
